package com.jianneng.jdg.model.homeactivity;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.Window;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.Toast;

import com.example.com.jianneng.jdg.R;
import com.jianneng.jdg.model.adapter.MyReleaseAdapter;
import com.jianneng.jdg.model.gallery.ReleaseListService;

public class MyReleaseActivity extends BaseActivity {
private ListView mListView;
private MyReleaseAdapter mAdapter;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		setContentView(R.layout.activity_my_release);
		init();
		mAdapter = new MyReleaseAdapter(this, ReleaseListService.getReleaseService());
		mListView.setAdapter(mAdapter);
		View  releaseView = LayoutInflater.from(this).inflate(R.layout.myrelease_listview_item, null);
		ImageView delete = (ImageView) releaseView.findViewById(R.id.delete_content);
		delete.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				Toast.makeText(MyReleaseActivity.this, "1111", 1).show();
			}
		});
		mListView.setOnItemClickListener(new OnItemClickListener() {
			@Override
			public void onItemClick(AdapterView<?> parent, View view,
					int position, long id) {
				Intent intent = new Intent(MyReleaseActivity.this, DetailsActivity.class);
				startActivity(intent);
				
				Toast.makeText(MyReleaseActivity.this, "123", 1).show();
				
			}
		}
		);
			
			
	}
	public class MyOnClickListener implements OnClickListener{
		@Override
		public void onClick(View v) {
			switch (v.getId()) {
//			case R.id.delete_content:
//				Toast.makeText(MyReleaseActivity.this, "1111", 1).show();
//				break;

			default:
				break;
			}
			
		}
		
	}
	private void init() {
		mListView = (ListView) findViewById(R.id.myrelease_listview);
		
	}

	
}
